package com.sgb.kjwl.view.ui.adapter.enterprise;

import android.content.Context;

import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ItemTwoLevelPickerBinding;
import com.sgb.kjwl.databinding.ItemTwoLevelPickerChangeBinding;
import com.sgb.kjwl.model.entity.ParentAreaEntity;
import com.sgb.kjwl.model.entity.PickSelectEntity2;
import com.sgb.kjwl.model.entity.TwoLevelEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

public class TwoLevelAdapter<D extends PickSelectEntity2> extends BaseRecycleAdapter<TwoLevelEntity<List<D>>> {
    public TwoLevelAdapter(Context context, List<TwoLevelEntity<List<D>>> datas) {
        super(context, R.layout.item_two_level_picker_change, datas);
    }

    @Override
    public void convert(ItemViewHolder holder, final TwoLevelEntity<List<D>> entity) {
        holder.setBinding(BR.viewModel, entity);

        ItemTwoLevelPickerChangeBinding binding = (ItemTwoLevelPickerChangeBinding) holder.getmBinding();
        if (entity.getColor() != 0){
            binding.rootLayout.setBackgroundResource(entity.getColor());
        }
    }
}
